package com.adteam.xmap.web;

import java.util.List;

import com.adteam.xmap.entity.Administrator;
import com.adteam.xmap.manager.AdministratorManager;
import com.opensymphony.xwork2.ActionSupport;

public class AdministratorAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	private AdministratorManager administratorManager;
	
	private Administrator administrator;
	
	private List administrators;
	
	private Integer id;
	

	@Override
	public String execute() {
		administrators = administratorManager.findAllAdministrators();
		return "SUCCESS";
	}
	
	public String addInput() {
		
		return "add_input";
	}
	
	public String add() {
		administratorManager.addAdministrator(administrator);
		return "add_success";
	}
	
	public String del() {
		administratorManager.delAdministrator(id);
		return "del_success";
	}
	
	public String updateInput() {
		
		return "update_input";
	}
	
	public String update() {
		administratorManager.updateAdministrator(administrator);
		return "update_success";
	}
	
	public String find() {
		administrator = administratorManager.findAdministratorById(id);
		return "find_success";
	}

	public AdministratorManager getAdministratorManager() {
		return administratorManager;
	}

	public void setAdministratorManager(AdministratorManager administratorManager) {
		this.administratorManager = administratorManager;
	}

	public Administrator getAdministrator() {
		return administrator;
	}

	public void setAdministrator(Administrator administrator) {
		this.administrator = administrator;
	}

	public List getAdministrators() {
		return administrators;
	}

	public void setAdministrators(List administrators) {
		this.administrators = administrators;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


}
